﻿@model CmsAdminContentModel

@{
    ResFile = "cms_Content";
}

@(Html.CmsGrid(Model.Contents, new { @class = "t-grid js-pager-container" }).Wrapper("ContentGrid")
    .Columns(
            columns =>
            {
                columns.HeaderCssClass("t-grid-header").Bound().Width(40).Title("Id").HtmlAttributes(new { @class = "t-header" });
                columns.Bound().Title(_("Content title")).HtmlAttributes(new { @class = "t-header" });
                columns.Bound().Title(_("Date created")).HtmlAttributes(new { @class = "t-header" });
                columns.Bound().Title("").HtmlAttributes(new { @class = "t-header" });
                columns.Bound().Width(40).Title("").HtmlAttributes(new { @class = "t-header" });
            })
    .Rows(
        rows =>
        {
            rows.Bound().RowItemTemplate(
                @<text>
                <span>@item["PublicContentId"]</span>
                </text>
                ).HtmlAttributes(new { @class = "text-center" });
            rows.Bound().RowItemTemplate(
                @<text>
                <a href="@Url.Action("edit", "cmscontent", new { id = item.Id })">@item["ContentTitle"]</a>
                </text>
                );
            rows.Bound().RowItemTemplate(
                @<text>
                <span>@item["DateCreated"]</span>
                </text>
                ).HtmlAttributes(new { @class = "text-center" });
            rows.Bound().RowItemTemplate(
                @<text>
                <span>@item.Id</span>
                </text>
                );
            rows.Bound().RowItemTemplate(
                @<text>
                <a class="b-icon b-icon_delete_custom js-ajax-link" data-confirm-message="@_("Are you sure you want to delete this item?")" data-container="#ContentGrid" title="Content" href="@Url.Action("delete", "cmscontent", new { id = item.Id })">@_("Delete")</a>
                </text>
                ).HtmlAttributes(new { @class = "t-last" });
        })
    .Render()
)

@if (!Model.HidePager)
{
    @Html.Partial("CmsPager", new {PageSize = 20, TotalCount = Model.Total, Url = Url.Action("Edit", "CmsContentType", new {id = Model.ContentType.Id})}.ToExpando())
}